package java8;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2018/7/21 9:57
 */
public class SimpleDateThreadLocal {
    private static final ThreadLocal<SimpleDateFormat> FORMAT_HOLDER = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyyMMdd"));

    public static Date convert(String str) throws ParseException {
        return FORMAT_HOLDER.get().parse(str);
    }
}
